#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
int main(int argc, char**argv)
{
    //打开文件
    int fd = open(argv[1], O_RDWR);
    if(fd == -1)
    {
        perror("open error:");
        return -1;
       
    }
   
    //测试
    write(fd,"pxl",4);
    write(fd,"123123",7);

    char buf[32] = {0};
    read(fd, buf, 4);
    printf("buf = %s\n", buf);//

    read(fd, buf, 4);
    printf("buf = %s\n", buf);

    
    //关闭文件
    close(fd);
}